package com.orange.score.activity.common;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Process;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.orange.common.android.activity.PPActivity;
import com.orange.score.activity.more.FeedbackActivity;
import com.orange.score.activity.more.ScorePromptActivity;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class CommonFootballActivity extends PPActivity
{
  private static final String TAG = "CommonFootballActivity";
  public static List<Activity> activityList = new LinkedList();
  private static boolean showNetError = false;

  private void exit()
  {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setTitle(2131361817);
    localBuilder.setPositiveButton(2131361815, new DialogInterface.OnClickListener(this)
    {
      public void onClick(, int paramInt)
      {
        this.this$0.exitApp();
      }
    });
    localBuilder.setNegativeButton(2131361816, new DialogInterface.OnClickListener(this)
    {
      public void onClick(, int paramInt)
      {
      }
    });
    localBuilder.create().show();
  }

  public void cancelNotification()
  {
    ((NotificationManager)getSystemService("notification")).cancel(2130837635);
  }

  public void exitApp()
  {
    cancelNotification();
    Iterator localIterator = activityList.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
      {
        Process.killProcess(Process.myPid());
        activityList.clear();
        return;
      }
      ((Activity)localIterator.next()).finish();
    }
  }

  public boolean haveInternet(Context paramContext)
  {
    int i;
    NetworkInfo localNetworkInfo = ((ConnectivityManager)paramContext.getSystemService("connectivity")).getActiveNetworkInfo();
    if ((localNetworkInfo == null) || (!(localNetworkInfo.isConnected())))
      i = 0;
    while (true)
    {
      while (true)
      {
        return i;
        if (!(localNetworkInfo.isRoaming()))
          break;
        i = 0;
      }
      i = 1;
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    activityList.add(this);
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131492864, paramMenu);
    return true;
  }

  public void onDestroy()
  {
    super.onDestroy();
    activityList.remove(this);
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool;
    if (paramInt == 4)
    {
      Log.i("CommonFootballActivity", "<onKeyDown>clcik back button,hide dialog");
      hideDialog();
      super.onBackPressed();
      bool = true;
    }
    while (true)
    {
      return bool;
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    int i = paramMenuItem.getItemId();
    Intent localIntent = new Intent();
    switch (i)
    {
    default:
    case 2131558564:
    case 2131558666:
    case 2131558667:
    case 2131558668:
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            return true;
            onRefresh();
          }
          localIntent.setClass(this, ScorePromptActivity.class);
          startActivity(localIntent);
        }
        localIntent.setClass(this, FeedbackActivity.class);
        startActivity(localIntent);
      }
      exit();
    }
  }

  public void onRefresh()
  {
  }
}